{include file="public/header" /}
<body>
<div class="x-body">
    <form class="layui-form">
        <div class="layui-form-item">
            <label class="layui-form-label">设备编号</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" name="equi_id" value="{$equi_id}" title="禁止修改" disabled>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">故障日期</label>
            <div class="layui-input-inline">
                <input type="text" name="date" id="date" lay-verify="date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">故障现象</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" name="action">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">原因分析</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" name="reason">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">维修方法</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" name="function">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">后期效果跟踪</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" name="track">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">维修人</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" name="maintenance_staff">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">审核人</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" name="auditor">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">经办人</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" name="agent" value="{$Think.session.user.user_name}" title="禁止修改" disabled>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" name="remarks">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"></label>
            <button class="layui-btn" lay-submit lay-filter="addId" >
                确认添加
            </button>
        </div>
    </form>
</div>
</body>
<script>
    //日期
    layui.use('laydate', function(){
        var laydate = layui.laydate;
        //执行一个laydate实例
        laydate.render({
            elem: '#date' //指定元素
        });
    });
    layui.use(['form'], function(){
        $ = layui.jquery;
        var form = layui.form,layer = layui.layer;
        //监听提交
        form.on('submit(addId)', function(data){
            //console.log(data);
            $.post("{:url('index/EquipmentMaintain/saveMaintainInfo')}",data.field,function(info){
                if (info) {
                    layer.alert("添加成功", {icon: 6},function () {
                        window.parent.location.reload();  //刷新父级页面
                        // 获得frame索引
                        var index = parent.layer.getFrameIndex(window.name);
                        //关闭当前弹出层
                        parent.layer.close(index);
                    });
                }else{
                    layer.alert("添加失败", {icon: 5});
                }
            },'json');
            return false;
        });
    });
</script>

</html>